<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return=array();
$return['pluginset']=$this->plugin_setting('areasetting');
$return['ischecklogin']=$this->model('member')->checklogin();
if($_RQ['op']=='main'){
	$isxuni=intval($_RQ['isxuni']);
	$return['setting']=$this->plugin_setting('areapage');
	$params=array('mid'=>$_SESSION['uid']);
	$return['commission_money']=$this->sum('commission',$params,'money');
	$return['commission_total']=$this->count('commission',$params);
	$levels=array();
	$return['area_types']=$this->area_types;
	for($i=0;$i<$this->areasetting['area_level'];$i++){
		$level=$i+3;
		$levels[$level]=$this->count('commission',array('mid'=>$_SESSION['uid'],'type'=>$level));
	}
	$return['levels']=$levels;
	$return['list']=array();
	$return['params']=array(
		'isarea'=>$isarea,
		'isxuni'=>$isxuni,
		'level'=>3,
		'page'=>1,
	);
	$return['psize']=20;
	$return['xuniname']=$this->xuniname;
	exi($return);
}
if($_RQ['op']=='getlist'){
	$pindex = max(1, intval($_RQ['page']));
	$psize = 15;
	$params=array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'type'=>array(3,4,5,6,7));
    $orderby='createtime desc';
	$total='';
	$return['list']=pdo_getslice('jy_nongfee_commission',$params,array($pindex,$psize),$total,$fields,'',$orderby);	
	foreach($return['list'] as &$v){
			$v['member']=cfc('core')->member_show($v['mid']);
			$v['createtime']=date('Y-m-d H:i:s',$v['createtime']);
			$v['statustitle']=$this->commission_status[$v['status']];
			$v['typetitle']=$this->commission_money_types[$v['type']];
	}
	exi($return);
}
?>